# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=peepingtom
pkgver=56.bc6f4d8
pkgrel=4
epoch=1
groups=('blackarch' 'blackarch-webapp' 'blackarch-recon')
pkgdesc='A tool to take screenshots of websites. Much like eyewitness.'
arch=('any')
url='https://bitbucket.org/LaNMaSteR53/peepingtom'
license=('GPL3')
depends=('python2' 'curl' 'phantomjs')
makedepends=('git')
source=("git+https://bitbucket.org/LaNMaSteR53/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  ln -s /usr/bin/phantomjs "$pkgdir/usr/share/$pkgname/phantomjs"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

